class Time {
    time: number | undefined
    debounce(cb: () => void, time = 100) {
        if (!this.time) {
            this.time = setTimeout(cb, time)
            setTimeout(() => {
                this.time = undefined
            }, time);
        }
    }
    throttle(cb: () => void, time = 100) {
        if (this.time) {
            console.log('time', this.time);
            
            clearTimeout(this.time)
            this.time = undefined
        }
        this.time = setTimeout(cb, time)
    }
}
export default Time